package com.service.socket.process;

import org.jboss.netty.channel.Channel;

import com.service.socket.protocol.CmdType;
import com.service.socket.protocol.Packet;

public class R_Class_Factory {
	public static R_Class_Abstract create(Channel channel, Packet packet) {
		if (CmdType.COCLASS_LINK.equals(packet.cmdType)) {
			// A0指令：链路操作
			return new R_Class_A0(channel, packet);
		} else if (CmdType.COCLASS_TRANSFER.equals(packet.cmdType)) {
			// B0指令：数据传输
			return new R_Class_B0(channel, packet);
		} else if (CmdType.COCLASS_PARAMETER_SETTING.equals(packet.cmdType)) {
			// B1指令：参数设置
			return new R_Class_B1(channel, packet);
		} else if (CmdType.COCLASS_PARAMETER_READ.equals(packet.cmdType)) {
			// B5指令：参数读取
			return new R_Class_B5(channel, packet);
		} else if (CmdType.COCLASS_LAST_QUERY.equals(packet.cmdType)) {
			// E0指令：查询每个gpsno对应的最新Signal
			return new R_Class_E0(channel,packet);
		} else if (CmdType.COCLASS_HOOK_QUERY.equals(packet.cmdType)) {
			return new R_Class_E1(channel, packet);
		} else if (CmdType.CTRL_User_CMD.equals(packet.cmdType)) {
			// C0指令：控制终端数据包
			return new R_Class_C0(channel, packet);
		} else if (CmdType.COCLASS_TERMINAL.equals(packet.cmdType)) {
			// F0指令：DTU主动请求
			return new R_Class_F0(channel,packet); 
		} else if (CmdType.REFRESH_VEHICLE_MAP.equals(packet.cmdType)) {
			// FA指令：DTU发送刷新缓存
			return new R_Class_FA(channel,packet); 
		} else if (CmdType.COCLASS_GARBAGE.equals(packet.cmdType)) {
			// FF指令：DTU发送垃圾称重
			return new R_Class_FF(channel,packet); 
		} else if (CmdType.REFRESH_SUBSPEED_MAP.equals(packet.cmdType)) {
			// FB指令：刷新副发缓存
			return new R_Class_FB(channel,packet); 
		}
		else {
			return null;
		}
	}
}
